package com.taxi.driver.module.login;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.WindowManager;

import com.taxi.driver.R;
import com.taxi.driver.common.BaseActivity;

/**
 * 登录页
 */
public class LoginActivity extends BaseActivity {

    public static void start(Context context) {
        Intent starter = new Intent(context, LoginActivity.class);
        starter.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(starter);
    }

    LoginFragment mLoginFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //该属性能防止屏幕被截图和录制。这个属性就是可以防止当前Activity不会被录制
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
                WindowManager.LayoutParams.FLAG_SECURE);
        setContentView(R.layout.activity_login);
        if (mLoginFragment == null) {
            mLoginFragment = LoginFragment.newInstance();
            addFragment(R.id.fragment_container, mLoginFragment);
        }
    }

    @Override
    public void onAttachFragment(Fragment fragment) {
        super.onAttachFragment(fragment);
        if (fragment instanceof LoginFragment) {
            mLoginFragment = (LoginFragment) fragment;
        }
    }

    @Override
    public int getBarColor() {
        return R.color.white;
    }
}
